<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>partial_sort</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C++ Algorithms</a> &gt; <a href=
    "partial_sort.html">partial_sort</a>
  </div>

  <div class="name-format">
    partial_sort
  </div>

  <div class="syntax-name-format">
    Syntax:
  </div>
  <pre class="syntax-box">
  #include &lt;algorithm&gt;
  void partial_sort( iterator start, iterator middle, iterator end );
  void partial_sort( iterator start, iterator middle, iterator end, StrictWeakOrdering cmp );
</pre>

  <p>The partial_sort() function arranges the first N elements of the
  range [<em>start</em>,<em>end</em>) in ascending order. N is defined
  as the number of elements between <em>start</em> and
  <em>middle</em>.</p>

  <p>By default, the &lt; operator is used to compare two elements. If
  the strict weak ordering comparison function <em>cmp</em> is given,
  it is used instead.</p>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    <a href="binary_search.html">binary_search</a><br>
    <a href="is_sorted.html">is_sorted</a><br>
    <a href="nth_element.html">nth_element</a><br>
    <a href="partial_sort_copy.html">partial_sort_copy</a><br>
    <a href="sort.html">sort</a><br>
    <a href="stable_sort.html">stable_sort</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
